<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
class DmdaotaoViewLinhvucnckh extends JViewLegacy {
	
	function display($tpl = null) {
	  $task = JRequest::getVar('task');
		  switch($task){
		   case 'checkTrungten':
		    $this->checkTrungten();
		    break;
  }
 }
 public function checkTrungten(){
 	$name = mb_strtoupper(JRequest::getVar('name', null, 'get', 'string'));
 	$db	=	JFactory::getDbo();
 	if (!empty($name)) {
 		$query = 'SELECT id FROM dm_linhvucnckh WHERE UCASE(name) = binary"'.$name.'"';
 		$db->setQuery( $query );
 		$rows = $db->loadResult();
 		header('charset:utf-8');
 		header('Content-type: application/json');
 		echo json_encode($rows);
 	}
 } 
}
?>
